﻿<%@ Page Language="C#" MasterPageFile="~/Site.master"  
CodeFile="DynamicHyperlinks.aspx.cs" 
Inherits="DocSamples_DynamicHyperlink" %>

<%@ Register src="~/DynamicData/Content/GridViewPager.ascx" tagname="GridViewPager" tagprefix="asp" %>

<%@ Register TagPrefix="ddue" TagName="info" Src="~/DynamicData/Content/MoreInformation.ascx" %>

<asp:Content ID="headContent" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">


    <asp:DynamicDataManager ID="DynamicDataManager1" runat="server" AutoLoadForeignKeys="true" />

   
    <h2 class="DDSubHeader">Creating Table Action Links</h2>

    <div class="ExampleView">   
        ASP.NET Dynamic Data lets you create dynamic hyperlinks that are based on the table actions 
        such as edit, insert, and so on.
    </div>
  
    <ddue:info id="InfoID" runat="server"      
        FilePath="DocumentationExamples\DynamicHyperlinks.htm" />

    <hr />
    
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
   
            <h3 class="DDSubHeader">Un-Bound Control Action Links</h3>
                 
            <div class="DDBottomHyperLink">
                <asp:DynamicHyperLink ID="DynamicHyperLink1" runat="server" Action="Insert"
                    ContextTypeName="AdventureWorksLT_DataModel.AdventureWorksLT_DataEntities"
                    TableName="ProductModels"><img id="Img1" runat="server" src="~/DynamicData/Content/Images/plus.gif" alt="Insert new item" />Insert new item
                </asp:DynamicHyperLink>
            </div>
       
            <br />
            
            <div class="DDBottomHyperLink">
                <asp:DynamicHyperLink ID="DynamicHyperLink2" runat="server" 
                    Action="Edit"  
                    ContextTypeName="AdventureWorksLT_DataModel.AdventureWorksLT_DataEntities"
                    TableName="ProductModels"  
                    ProductModelID="1"><img id="Img2" runat="server" src="~/DynamicData/Content/Images/back.gif" alt="Insert new item" />Edit item
                </asp:DynamicHyperLink>
            </div>
            
            <hr />
            
            <h3 class="DDSubHeader">Data-Bound Control Table Action Links</h4>
        
            <asp:GridView ID="GridView2" runat="server" 
                CssClass="DDGridView" AutoGenerateColumns="false" CellPadding="6">
                <Columns>
                    <asp:TemplateField HeaderText="Table Name" SortExpression="TableName">
                        <ItemTemplate>
                            <asp:DynamicHyperLink ID="HyperLink1" runat="server"><%# Eval("DisplayName") %></asp:DynamicHyperLink>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>
    
   
            <hr />
            
            <h3 class="DDSubHeader">Data-Bound Control Row Action Links</h3>
            
            <asp:GridView ID="GridView1" runat="server" 
                CssClass="DDGridView" AllowPaging="true" PageSize="5"
                DataSourceID="EntityDataSource1">
                    <Columns>
                        <asp:TemplateField>
                            <ItemTemplate>
                                <asp:DynamicHyperLink ID="EditHyperLink" 
                                    runat="server"  
                                    Action="Edit" Text="Edit" />       
                            </ItemTemplate> 
                        </asp:TemplateField>    
                    </Columns>
            </asp:GridView>
    
            <asp:EntityDataSource ID="EntityDataSource1" runat="server" 
                ConnectionString="name=AdventureWorksLT_DataEntities" 
                DefaultContainerName="AdventureWorksLT_DataEntities" EnableFlattening="False" 
                EnableUpdate="True" EntitySetName="Products" EnableInsert="True">
            </asp:EntityDataSource>
          
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
